<%
if respond_to?(:current_component) && current_component && can_be_managed?(current_component)
  edit_link(
    manage_component_path(current_component),
    :read,
    :component,
    component: current_component,
    current_participatory_space:
  )
end
%>

<div class="layout-container">
  <header <%= "class=with-admin-bar" if current_user && allowed_to?(:read, :admin_dashboard) %>>
    <div id="sticky-header-container" data-controller="sticky-header">
      <%= render partial: "layouts/decidim/impersonation_warning" %>
      <%= render partial: "layouts/decidim/omnipresent_banner" %>
      <%= render partial: "layouts/decidim/offline_banner" %>
      <%= render partial: "layouts/decidim/admin_links" if current_user && allowed_to?(:read, :admin_dashboard) %>
      <%= render partial: "layouts/decidim/header/main" %>
    </div>
    <div id="menu-bar-container">
      <% if !current_user&.ephemeral? && !content_for?(:focus_mode) %>
        <%= render partial: "layouts/decidim/header/menu" unless controller_name == "homepage" %>
      <% end %>
    </div>
  </header>

  <% if display_flash_messages.present? %>
    <div id="flash-messages-container" class="container">
      <%= display_flash_messages %>
    </div>
  <% end %>
  <%= display_onboarding_action_message(current_user) %>

  <div id="content" data-content>
    <%= yield %>
  </div>

  <footer>
    <% if current_user&.ephemeral? || content_for?(:focus_mode) %>
      <%= render partial: "layouts/decidim/footer/focus_mode_main" %>
    <% else %>
      <%= render partial: "layouts/decidim/footer/main" %>
      <%= render partial: "layouts/decidim/footer/mini" %>
    <% end %>
  </footer>
</div>
